﻿using System.Collections.Generic;
using System.Web.Mvc;

namespace Journal.Common.Extensions
{
    public static class TagBuilderExtensions
    {
        public static TagBuilder InsertDataAttributes(this TagBuilder builder, IDictionary<string, string> dataParams)
        {
            if (dataParams != null)
            {
                foreach (var item in dataParams)
                {
                    builder.Attributes.Add(string.Format("data-{0}", item.Key), item.Value);
                }
            }

            return builder;
        }
    }
}